package org.example.mulitithreading.ex2p;

public class Ex2pDemo {
    public static void main(String[] args) {
//        test1();
        test2();
//        test3();
//        test4();
    }

    private static void test4() {
        //创建SellTicket类的对象
        SellTicket4 st = new SellTicket4();

        //创建三个Thread类的对象，把SellTicket对象作为构造方法的参数，并给出对应的窗口名称
        Thread t1 = new Thread(st,"窗口1");
        Thread t2 = new Thread(st,"窗口2");

        //启动线程
        t1.start();
        t2.start();
    }

    public static void test1(){
        //创建SellTicket类的对象
        SellTicket st = new SellTicket();

        //创建三个Thread类的对象，把SellTicket对象作为构造方法的参数，并给出对应的窗口名称
        Thread t1 = new Thread(st,"窗口1");
        Thread t2 = new Thread(st,"窗口2");
        Thread t3 = new Thread(st,"窗口3");

        //启动线程
        t1.start();
        t2.start();
        t3.start();
    }

    public static void test2(){
        //创建SellTicket类的对象
        SellTicket2 st = new SellTicket2();

        //创建三个Thread类的对象，把SellTicket对象作为构造方法的参数，并给出对应的窗口名称
        Thread t1 = new Thread(st,"窗口1");
        Thread t2 = new Thread(st,"窗口2");

        //启动线程
        t1.start();
        t2.start();
    }

    public static void test3() {
        SellTicket3 t1 = new SellTicket3();
        SellTicket3 t2 = new SellTicket3();
        SellTicket3 t3 = new SellTicket3();
        t1.setName("窗口1");
        t2.setName("窗口2");
        t3.setName("窗口3");

        t1.start();
        t2.start();
        t3.start();
    }
}
